home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
Misc Utils
/
Dynamic Math 1.0.1
/
DynamicMath.Int
< prev
Wrap
Text File
|
1993-04-19
|
1KB
|
49 lines
unit DynamicMath;
{ Dynamic Math. A library to parse and interpret formulas during }
{ the programs execution time }
{}
{ © 1993 by Christian Franz }
interface
const
eClsExpected = -1; (* ")" expected *)
eOpnExpected = -2; (* "(" expected *)
eUnknownSymbol = -3; (* unknown function *)
eSyntaxError = -4; (* formula is wrong. usually missing '(' ')' around Expr *)
{$PUSH}
{$J+}
type
(* The Item object is just defined so your *)
(* compiler doesn't gag on the Formula *)
(* definition. Don't change or even use it! *)
Item = object (* don't ever mess with me *)
thevalue: real;
negate: boolean;
function evaluate: real; (* no you don't *)
end;
Formula = object
structure: Item;
function evaluate (x, y: real): real;
(* call me to evaluate parsed function *)
end;
var
gPos: integer;
{$J-}
{POP}
procedure Str2Text (s: Str255; var t: CharsHandle);
function Parse (text: CharsHandle; var theFormula: Formula): Integer;
implementation
end.